#include <asm.h>
#include <regdef.h>
#include <inst_test.h>

LEAF(n36_divu_test)
    .set noreorder
    addiu s0, s0 ,1
    li  s2, 0x0
###test inst
    TEST_DIVU(0x4e775a80, 0xb26795ec, 0x00000000, 0x4e775a80)
    TEST_DIVU(0x4e888700, 0xf0d84fce, 0x00000000, 0x4e888700)
    TEST_DIVU(0x01dea048, 0xf2c74100, 0x00000000, 0x01dea048)
    TEST_DIVU(0x77e68950, 0x8b0ddad0, 0x00000000, 0x77e68950)
    TEST_DIVU(0x72013c68, 0x48cb8680, 0x00000001, 0x2935b5e8)
    TEST_DIVU(0x7fb2e9a0, 0xc9af5700, 0x00000000, 0x7fb2e9a0)
    TEST_DIVU(0xd7042938, 0x018a7078, 0x0000008b, 0x00d91810)
    TEST_DIVU(0xbf81441b, 0x704e3f24, 0x00000001, 0x4f3304f7)
    TEST_DIVU(0xeb5994e6, 0x622f1558, 0x00000002, 0x26fb6a36)
    TEST_DIVU(0x11176c40, 0x8128af78, 0x00000000, 0x11176c40)
    TEST_DIVU(0x32893870, 0xab09b9c0, 0x00000000, 0x32893870)
    TEST_DIVU(0x403c60c0, 0x6fe79f00, 0x00000000, 0x403c60c0)
    TEST_DIVU(0xaf855e42, 0x314b3730, 0x00000003, 0x1ba3b8b2)
    TEST_DIVU(0xdaa8cd0c, 0xd8f7eb07, 0x00000001, 0x01b0e205)
    TEST_DIVU(0x26aa8c2c, 0x2db52200, 0x00000000, 0x26aa8c2c)
    TEST_DIVU(0x933824b0, 0x97422b30, 0x00000000, 0x933824b0)
    TEST_DIVU(0x0d527980, 0x19233f98, 0x00000000, 0x0d527980)
    TEST_DIVU(0xfcb1d1f0, 0x2cc89437, 0x00000005, 0x1cc6ecdd)
    TEST_DIVU(0xd711e228, 0xdc4d82f5, 0x00000000, 0xd711e228)
    TEST_DIVU(0xe3e9c400, 0x5e37e5e0, 0x00000002, 0x2779f840)
    TEST_DIVU(0xec9a8080, 0x21240ee0, 0x00000007, 0x049e1860)
    TEST_DIVU(0xb0e35480, 0x8947ed80, 0x00000001, 0x279b6700)
    TEST_DIVU(0x0392b91c, 0x985ef388, 0x00000000, 0x0392b91c)
    TEST_DIVU(0x39856e38, 0xb0c0860c, 0x00000000, 0x39856e38)
    TEST_DIVU(0x9a86f9a7, 0x62ff4728, 0x00000001, 0x3787b27f)
    TEST_DIVU(0x0ce5e850, 0x47adbcf0, 0x00000000, 0x0ce5e850)
    TEST_DIVU(0xf4611640, 0x5d25556e, 0x00000002, 0x3a166b64)
    TEST_DIVU(0xb7f4a7f2, 0x2dbcce30, 0x00000004, 0x01016f32)
    TEST_DIVU(0xd5e74ce0, 0x7cc662f7, 0x00000001, 0x5920e9e9)
    TEST_DIVU(0x9988ceac, 0xf076e887, 0x00000000, 0x9988ceac)
    TEST_DIVU(0x850dcbd5, 0x59d75300, 0x00000001, 0x2b3678d5)
    TEST_DIVU(0x16d37c76, 0x674dc83e, 0x00000000, 0x16d37c76)
    TEST_DIVU(0xa9589416, 0xa35bff94, 0x00000001, 0x05fc9482)
    TEST_DIVU(0xa1909a9f, 0xa0601410, 0x00000001, 0x0130868f)
    TEST_DIVU(0x21e6ad92, 0x38937558, 0x00000000, 0x21e6ad92)
    TEST_DIVU(0x34097bd4, 0x24334f00, 0x00000001, 0x0fd62cd4)
    TEST_DIVU(0x00d69f51, 0x638398c6, 0x00000000, 0x00d69f51)
    TEST_DIVU(0xce523680, 0x3aa421ac, 0x00000003, 0x1e65d17c)
    TEST_DIVU(0x06be2bd0, 0x7e0469c0, 0x00000000, 0x06be2bd0)
    TEST_DIVU(0x3c8a3ed0, 0x96ba84a4, 0x00000000, 0x3c8a3ed0)
    TEST_DIVU(0xcdb7e7a0, 0xf02ec50b, 0x00000000, 0xcdb7e7a0)
    TEST_DIVU(0x3e73f907, 0x343cb0fc, 0x00000001, 0x0a37480b)
    TEST_DIVU(0x80c64528, 0x514002d0, 0x00000001, 0x2f864258)
    TEST_DIVU(0x307ff23f, 0x49cb4594, 0x00000000, 0x307ff23f)
    TEST_DIVU(0x1a5c1b18, 0x354f3820, 0x00000000, 0x1a5c1b18)
    TEST_DIVU(0x152adedb, 0x92367480, 0x00000000, 0x152adedb)
    TEST_DIVU(0x87c6b4d4, 0x5fe2d74f, 0x00000001, 0x27e3dd85)
    TEST_DIVU(0x0a979968, 0x95636cf8, 0x00000000, 0x0a979968)
    TEST_DIVU(0x9a022056, 0xba1fcd4e, 0x00000000, 0x9a022056)
    TEST_DIVU(0x89ed9f82, 0x6ede448c, 0x00000001, 0x1b0f5af6)
    TEST_DIVU(0xe27700a0, 0x96ae437e, 0x00000001, 0x4bc8bd22)
    TEST_DIVU(0xfa35607c, 0x0c845564, 0x00000013, 0x0c630a10)
    TEST_DIVU(0xfd23f6f0, 0x679ba312, 0x00000002, 0x2decb0cc)
    TEST_DIVU(0x80ede740, 0x91669d00, 0x00000000, 0x80ede740)
    TEST_DIVU(0x8163addd, 0x9c11473c, 0x00000000, 0x8163addd)
    TEST_DIVU(0xa8ff5154, 0xb2f04618, 0x00000000, 0xa8ff5154)
    TEST_DIVU(0x7f5938cd, 0x0b297e38, 0x0000000b, 0x0490cc65)
    TEST_DIVU(0xc024b7e4, 0x8cd258b8, 0x00000001, 0x33525f2c)
    TEST_DIVU(0xe4c9469c, 0x06d92da8, 0x00000021, 0x02ca63f4)
    TEST_DIVU(0x945fdc7a, 0x2f800526, 0x00000003, 0x05dfcd08)
    TEST_DIVU(0xcfc7186c, 0x0dec23ce, 0x0000000e, 0x0cdd2328)
    TEST_DIVU(0x1c80a1b0, 0xc1ca066e, 0x00000000, 0x1c80a1b0)
    TEST_DIVU(0x8c14bff0, 0xdbebf5fc, 0x00000000, 0x8c14bff0)
    TEST_DIVU(0xfbefef80, 0x101746e1, 0x0000000f, 0x0a92c851)
    TEST_DIVU(0xfd96711e, 0xaf0fc990, 0x00000001, 0x4e86a78e)
    TEST_DIVU(0x7fb0d7f1, 0x137ff578, 0x00000006, 0x0ab11721)
    TEST_DIVU(0x6123f8e8, 0x698d919c, 0x00000000, 0x6123f8e8)
    TEST_DIVU(0x1bc6d70c, 0x175203f8, 0x00000001, 0x0474d314)
    TEST_DIVU(0x49a78e40, 0xb48180ca, 0x00000000, 0x49a78e40)
    TEST_DIVU(0x02f09920, 0x25c6fee0, 0x00000000, 0x02f09920)
    TEST_DIVU(0x0a15a7d4, 0x36fc8496, 0x00000000, 0x0a15a7d4)
    TEST_DIVU(0xfbd91080, 0xc13d2d2a, 0x00000001, 0x3a9be356)
    TEST_DIVU(0xd0a0b000, 0x70dedc87, 0x00000001, 0x5fc1d379)
    TEST_DIVU(0x29a5da10, 0xb87e9c40, 0x00000000, 0x29a5da10)
    TEST_DIVU(0x60670d88, 0x2b231300, 0x00000002, 0x0a20e788)
    TEST_DIVU(0x9e5828c2, 0x4040cf00, 0x00000002, 0x1dd68ac2)
    TEST_DIVU(0x61a97c80, 0x0a2468b8, 0x00000009, 0x0661ce08)
    TEST_DIVU(0x94e8395f, 0xe5bd280c, 0x00000000, 0x94e8395f)
    TEST_DIVU(0x2aba4e7a, 0x482d7bc0, 0x00000000, 0x2aba4e7a)
    TEST_DIVU(0x0f578130, 0x6a1d0b70, 0x00000000, 0x0f578130)
    TEST_DIVU(0x9e8536f4, 0x7a2feeb0, 0x00000001, 0x24554844)
    TEST_DIVU(0x6b7dc118, 0x034fb77a, 0x00000020, 0x0186d1d8)
    TEST_DIVU(0xc8b2bb64, 0x1e1293c0, 0x00000006, 0x144344e4)
    TEST_DIVU(0x5a45b336, 0xd4fdd710, 0x00000000, 0x5a45b336)
    TEST_DIVU(0x6a654c20, 0x8148b638, 0x00000000, 0x6a654c20)
    TEST_DIVU(0xe7940e6c, 0x7526c3ea, 0x00000001, 0x726d4a82)
    TEST_DIVU(0x18be7274, 0xe2792f48, 0x00000000, 0x18be7274)
    TEST_DIVU(0xe434cf56, 0x7ce3a860, 0x00000001, 0x675126f6)
    TEST_DIVU(0xfa77a0a8, 0xb9d39f88, 0x00000001, 0x40a40120)
    TEST_DIVU(0x50335bbb, 0x950aa144, 0x00000000, 0x50335bbb)
    TEST_DIVU(0x63c427d6, 0xe8d25300, 0x00000000, 0x63c427d6)
    TEST_DIVU(0x16c3484f, 0xdb114140, 0x00000000, 0x16c3484f)
    TEST_DIVU(0x120a7000, 0xabcddb30, 0x00000000, 0x120a7000)
    TEST_DIVU(0x1f58c45c, 0xad2e3d9f, 0x00000000, 0x1f58c45c)
    TEST_DIVU(0x24dbaf34, 0x9aebdeca, 0x00000000, 0x24dbaf34)
    TEST_DIVU(0xa8b75800, 0x7de01766, 0x00000001, 0x2ad7409a)
    TEST_DIVU(0xbdba6308, 0xc7fa2550, 0x00000000, 0xbdba6308)
    TEST_DIVU(0x99a3fd70, 0x67bd7960, 0x00000001, 0x31e68410)
    TEST_DIVU(0x6a9dcfc0, 0x43d097e7, 0x00000001, 0x26cd37d9)
    TEST_DIVU(0xc89ce2a6, 0xffeb1c50, 0x00000000, 0xc89ce2a6)
    TEST_DIVU(0xf9087cc8, 0x12400558, 0x0000000d, 0x0bc83750)
    TEST_DIVU(0x71d79ea0, 0xf9c35ddc, 0x00000000, 0x71d79ea0)
    TEST_DIVU(0xa18e9d80, 0x4e037d7c, 0x00000002, 0x0587a288)
    TEST_DIVU(0x9fd0aeb1, 0xf59bf246, 0x00000000, 0x9fd0aeb1)
    TEST_DIVU(0xd8320444, 0x716e5200, 0x00000001, 0x66c3b244)
    TEST_DIVU(0xe484070c, 0x73d45434, 0x00000001, 0x70afb2d8)
    TEST_DIVU(0xf4d63b98, 0xb57fc508, 0x00000001, 0x3f567690)
    TEST_DIVU(0xe2f55044, 0xf53819b4, 0x00000000, 0xe2f55044)
    TEST_DIVU(0x2a241bb0, 0x318e3806, 0x00000000, 0x2a241bb0)
    TEST_DIVU(0xf66b2609, 0x49346ff4, 0x00000003, 0x1acdd62d)
    TEST_DIVU(0x06927823, 0xcc065fbd, 0x00000000, 0x06927823)
    TEST_DIVU(0x5aa7865c, 0x37037ada, 0x00000001, 0x23a40b82)
    TEST_DIVU(0x9770dac0, 0xe8669633, 0x00000000, 0x9770dac0)
    TEST_DIVU(0xa96b6404, 0x36e6cb60, 0x00000003, 0x04b701e4)
    TEST_DIVU(0xfc71887e, 0x998680d0, 0x00000001, 0x62eb07ae)
    TEST_DIVU(0x1966d6a4, 0x647c7020, 0x00000000, 0x1966d6a4)
    TEST_DIVU(0xa8e220c4, 0xeb56ad48, 0x00000000, 0xa8e220c4)
    TEST_DIVU(0x5950b640, 0x38742cd3, 0x00000001, 0x20dc896d)
    TEST_DIVU(0xa11a3e87, 0x5af351a0, 0x00000001, 0x4626ece7)
    TEST_DIVU(0x63d2bd00, 0x42d0a200, 0x00000001, 0x21021b00)
    TEST_DIVU(0x8fe90d8e, 0xb366c608, 0x00000000, 0x8fe90d8e)
    TEST_DIVU(0x0908a490, 0x59918c08, 0x00000000, 0x0908a490)
    TEST_DIVU(0xd30c8a6c, 0x2ae73552, 0x00000004, 0x276fb524)
    TEST_DIVU(0x61e924f8, 0x61bec600, 0x00000001, 0x002a5ef8)
    TEST_DIVU(0xf45f6ed8, 0x131bfc78, 0x0000000c, 0x0f0f9938)
    TEST_DIVU(0x1fbf1006, 0x64e404e0, 0x00000000, 0x1fbf1006)
    TEST_DIVU(0x70e216ac, 0xa748d3f9, 0x00000000, 0x70e216ac)
    TEST_DIVU(0x9ca20f65, 0xb354a050, 0x00000000, 0x9ca20f65)
    TEST_DIVU(0x3aa65400, 0x472877d0, 0x00000000, 0x3aa65400)
    TEST_DIVU(0xaa245e30, 0x3f5a2ef4, 0x00000002, 0x2b700048)
    TEST_DIVU(0x76e27de0, 0xbef0a908, 0x00000000, 0x76e27de0)
    TEST_DIVU(0x8bd8dae8, 0x95a7b198, 0x00000000, 0x8bd8dae8)
    TEST_DIVU(0x771fef95, 0x40f86998, 0x00000001, 0x362785fd)
    TEST_DIVU(0x4b881a60, 0x45aa8b18, 0x00000001, 0x05dd8f48)
    TEST_DIVU(0x30bdc4e9, 0x81168740, 0x00000000, 0x30bdc4e9)
    TEST_DIVU(0x770c5798, 0x3f28fa66, 0x00000001, 0x37e35d32)
    TEST_DIVU(0xdeb9ee04, 0x3126ea9c, 0x00000004, 0x1a1e4394)
    TEST_DIVU(0x48ae81f0, 0x5e0c351c, 0x00000000, 0x48ae81f0)
    TEST_DIVU(0x8c73948c, 0xe6c8142a, 0x00000000, 0x8c73948c)
    TEST_DIVU(0x2d02be90, 0x3d69ba94, 0x00000000, 0x2d02be90)
    TEST_DIVU(0x622d0eec, 0x7b68c7db, 0x00000000, 0x622d0eec)
    TEST_DIVU(0x23aeabc0, 0xa6757640, 0x00000000, 0x23aeabc0)
    TEST_DIVU(0xa42405dc, 0x81ae85b0, 0x00000001, 0x2275802c)
    TEST_DIVU(0x5ffb5218, 0xe6ff1010, 0x00000000, 0x5ffb5218)
    TEST_DIVU(0x7d92100f, 0x54b4ea50, 0x00000001, 0x28dd25bf)
    TEST_DIVU(0x890efcf8, 0x44890dbe, 0x00000001, 0x4485ef3a)
    TEST_DIVU(0xa40ce6b4, 0xb0285cf8, 0x00000000, 0xa40ce6b4)
    TEST_DIVU(0x2c2a9fc2, 0x2c677764, 0x00000000, 0x2c2a9fc2)
    TEST_DIVU(0x22387270, 0x1ffac566, 0x00000001, 0x023dad0a)
    TEST_DIVU(0xa41f02e0, 0xba831348, 0x00000000, 0xa41f02e0)
    TEST_DIVU(0x74d4d90c, 0xf943bdf7, 0x00000000, 0x74d4d90c)
    TEST_DIVU(0x7f8f69a8, 0x101d39a2, 0x00000007, 0x0ec2d63a)
    TEST_DIVU(0xf36ea730, 0x18ad84b0, 0x00000009, 0x1554fd00)
    TEST_DIVU(0xb95efa94, 0x0f34d9c6, 0x0000000c, 0x02e4c54c)
    TEST_DIVU(0x36a2aa20, 0xad414f06, 0x00000000, 0x36a2aa20)
    TEST_DIVU(0xfad69b46, 0xd35319d4, 0x00000001, 0x27838172)
    TEST_DIVU(0x3a7dca48, 0xd0269d48, 0x00000000, 0x3a7dca48)
    TEST_DIVU(0xc01fc0f0, 0x5f2bdce0, 0x00000002, 0x01c80730)
    TEST_DIVU(0x136c2456, 0xd2f7a520, 0x00000000, 0x136c2456)
    TEST_DIVU(0xea6462b8, 0x27475ad2, 0x00000005, 0x25ff9c9e)
    TEST_DIVU(0x45f1cbe2, 0x187f9910, 0x00000002, 0x14f299c2)
    TEST_DIVU(0xc33b85ca, 0x126449e8, 0x0000000a, 0x0b50a2ba)
    TEST_DIVU(0x20273480, 0xf35db380, 0x00000000, 0x20273480)
    TEST_DIVU(0xafa66e60, 0xeb2ac674, 0x00000000, 0xafa66e60)
    TEST_DIVU(0xad868694, 0xd7866c44, 0x00000000, 0xad868694)
    TEST_DIVU(0x702f1d39, 0xcba2eeb0, 0x00000000, 0x702f1d39)
    TEST_DIVU(0x83f86060, 0x29370ff3, 0x00000003, 0x08533087)
    TEST_DIVU(0xaf7adfb0, 0xb1424b48, 0x00000000, 0xaf7adfb0)
    TEST_DIVU(0x9adb0050, 0xa09fcd00, 0x00000000, 0x9adb0050)
    TEST_DIVU(0xf2f16e2e, 0x7573d2f8, 0x00000002, 0x0809c83e)
    TEST_DIVU(0x99951902, 0x8a360740, 0x00000001, 0x0f5f11c2)
    TEST_DIVU(0x00000000, 0xbea685ab, 0x00000000, 0x00000000)
    TEST_DIVU(0x00000000, 0x207ed850, 0x00000000, 0x00000000)
    TEST_DIVU(0x00000000, 0x72c14afa, 0x00000000, 0x00000000)
    TEST_DIVU(0x00000000, 0xae5365c0, 0x00000000, 0x00000000)
    TEST_DIVU(0x00000000, 0x9670f9f0, 0x00000000, 0x00000000)
    TEST_DIVU(0x00000000, 0x8e85bf30, 0x00000000, 0x00000000)
    TEST_DIVU(0x00000000, 0x11f1eca7, 0x00000000, 0x00000000)
###detect exception
    bne s2, zero, inst_error
    nop
###score ++
    addiu s3, s3, 1
###output (s0<<24)|s3
inst_error:  
    sll t1, s0, 24
    or t0, t1, s3 
    sw t0, 0(s1)
    jr ra
    nop
END(n36_divu_test)
